//
//  BQCycleCell.m
//  BeeQuick
//
//  Created by Vivitickey on 2017/4/26.
//  Copyright © 2017年 test. All rights reserved.
//

#import "BQCycleCell.h"
#import "BQHomeModel.h"
#import "BQAccountManager.h"

#import <SDCycleScrollView/SDCycleScrollView.h>
#import <YYModel/YYModel.h>
@interface BQCycleCell ()<SDCycleScrollViewDelegate>

@end


@implementation BQCycleCell{
    
    NSArray <BQHomeModel *>*_dataArray;
    
}

-(instancetype)initWithFrame:(CGRect)frame{
    
    if (self = [super initWithFrame:frame]) {
        
        _dataArray = [NSArray array];
        
        [self setupUI];
    }
    
    return self;
}

-(void)setupUI{
    
//    NSArray *urlGroup = @[@"http://img01.bqstatic.com/upload/activity/2017042515590063.jpg@90Q.jpg",
//                          @"http://img01.bqstatic.com/upload/activity/2017040517374943.jpg@90Q.jpg",
//                          @"http://img01.bqstatic.com/upload/activity/2016123018095821.jpg@90Q.jpg"
//                          ];
    NSMutableArray *urlGroup = [NSMutableArray array];
    
    NSDictionary *para = @{@"call" : @1};
    
    [_AccountMgr POSTWithUrlString:focus_url parameters:para success:^(id responseObject) {
        
        // 获取轮播器模型数组
        NSArray *dictArray = responseObject[@"data"][@"focus"];
        
        _dataArray = [NSArray yy_modelArrayWithClass:[BQHomeModel class] json:dictArray];
        
        for (BQHomeModel *model in _dataArray) {
            
            [urlGroup addObject:model.img];
            
        }
        
        SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, _ScreenWidth, 180) imageURLStringsGroup:urlGroup];
        
        cycleScrollView.placeholderImage = [UIImage imageNamed:@"bookbottomdefault"];
        
        cycleScrollView.currentPageDotImage = [UIImage imageNamed:@"icon_selected_dot"];
        
        cycleScrollView.pageDotImage = [UIImage imageNamed:@"icon_dot"];
        
        [self.contentView addSubview:cycleScrollView];
        
        
    } failure:^(NSError *error) {
        NSLog(@"%@",error);
    }];
    




        


    
}


                                          

@end
